package com.crazymaker.springcloud.message.dao.po;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;


/**
 * db push_center_m
 drop database   push_center_m0;
 drop database   push_center_m1

 create database push_center_m0 default character set utf8mb4 collate utf8mb4_unicode_ci;
 create database push_center_m1 default character set utf8mb4 collate utf8mb4_unicode_ci;

 */
@Entity
@Table(name = "message" )
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MsgPO
{
    /**
     * ID
     */
    @Id
//    @GenericGenerator(
//            name = "commonZkSequenceIdGenerator",
//            strategy = "com.crazymaker.springcloud.standard.hibernate.CommonZkSequenceIdGenerator" )
//    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "commonZkSequenceIdGenerator" )

//    @GenericGenerator(
//            name = "snowflakeIdGenerator",
//            strategy = "com.crazymaker.springcloud.standard.hibernate.CommonSnowflakeIdGenerator")
//    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "snowflakeIdGenerator")

    //由外部指定
    @GenericGenerator(name = "messageGenerator", strategy = "assigned")
    @GeneratedValue(generator = "messageGenerator")
    @Column(name = "msg_id", unique = true, nullable = false, length = 20)
    private Long msgId;


    /**
     * app编号
     */
    @Column(name = "app_key")
    private String appKey;

    /**
     * app id
     */
    @Column(name = "app_id")
    private Long appId;

    /**
     * 渠道类型
     * 1 websocket  2 alibaba 阿里云推送  3 短信  4 企业微信   5 钉钉   6....
     * 备注： 第2期将改为 位的模式，实现一次多种渠道推送
     */
    @Column(name = "target_type")
    private Integer targetType;

    /**
     * 推送账号
     * 多个账号，以分号隔开
     */
    @Column(name = "target_ids")
    private String targetIds;


    /**
     * 消息的标题
     */
    @Column(name = "title")
    private String title;

    /**
     * 消息内容
     */
    @Column(name = "body")
    private String body;

    /**
     * 创建时间
     */
    @Column(name = "create_date")
    private Date createTime;


    /**
     * 延时级别  通rocketmq的延迟级别
     */
    @Column(name = "delay_level" )
    private Integer delayLevel;


    /**
     * 预留 1，供业务使用
     */
    @Column(name = "ext_field_1")
    private String extField1;

    /**
     * 预留 2，供业务使用
     */
    @Column(name = "ext_field_2")
    private String extField2;

    /**
     * 预留 3，供业务使用
     */
    @Column(name = "ext_field_3")
    private String extField3;

    /**
     * 预留 4，供业务使用
     */
    @Column(name = "ext_field_4")
    private String extField4;
}